package com.eduran.test.model.logger;


import com.eduran.test.model.ConsoleWriter;
import com.eduran.test.model.LogWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class Logger_027 {
    private ConsoleWriter consoleWriter;
    private LogWriter fileWriter;

    @Autowired
    @Qualifier("toconsole")
    public void setConsoleWriter(ConsoleWriter writer) {
        this.consoleWriter = writer;
    }

    @Autowired
    public void setFileWriter(LogWriter fileWriter) {
        this.fileWriter = fileWriter;
    }

    public void writeFile(String text) {
        fileWriter.write(text);
    }

    public void writeConsole(String text) {
        if (consoleWriter != null)
            consoleWriter.write(text);
    }
}
